Given a 2D matrix, implement a function to rotate the grid 90 degrees clockwise. Return a new matrix, so rectangular inputs are supported and the original matrix need not be modified. Use def rotate_matrix(matrix):; an r x c input produces a c x r output, such as [[1,2,3],[4,5,6]] becoming [[4,1],[5,2],[6,3]]. Assume the matrix is non-empty, rectangular, and contains integers.
def rotate_matrix(matrix):