Rotate an image through a byte array?

Im trying to rotate an Image 90 degrees clockwise in some unity script I have. Ive looked around but cant seem to find a good answer for this. Since Unity doesnt have direct access to the bitmap classes Im unsure how to accomplish this. Ive also tried modifying the byte array but im not great at the math that would go with that. Please help.

How are you using a byte array to represent an image?
Wouldn’t it make more sense to use Color?

Rotating a bidimensional array is just swapping the x indexes for the y indexes.