Sorry for a stupid question, just haven't dealt with maths in quite a while, would be grateful if someone could explain this school grade math equation to me. Pic related.
x= xcos theta - y costheta
y = x sintheta + y cos(theta)
or something like that. Look up quadratic forms (matrices) and rotations of (x, y) column vectors.
The formula for what you have is z = Tranpose(v) tranpose(R) [1/a^2 0 0 -1/b^2] R v
where v is [x y] in column form and R is your rotation matrix and [1/a^2 0 0 -1/b^2] is an obvious 2x2 Matrix.