Created function to rotate 2D matrix for problem 1.6