Add CopyToArray method for IPalette.

By allowing a palette to be copied to an array, a speedup can be gained in HardwarePalette since palettes can be block copied using native magic rather than having to copy them item by item. We transpose the buffer in HardwarePalette in order to allow a contiguous block copy into this buffer, transposing again in the shader to keep everything correct.
Merge pull request #7091 from RoosterDragon/buffer-copy-palettes

Block copy palettes