Write a function called rotate that takes in an image array and a number. The number represents the number of times the function will rotate the image clockwise by 90 degrees. A negative number signifies counter-clockwise rotation and a positive one signifies clockwise rotation.
Remember image matrices have to be of type uint, so make sure to cast the result at the end.