rotate3D function

Rotate a 3D array in 90 degree steps.