Added a rotate function for the matrix class