Rotating a 2D Matrix

Or maybe someone has a link, where the math behind texture mapping is explained?