x = (x * cos(theta)) - (y * sin(theta))

y = (x * sin(theta)) + (y * cos(theta))

I'd have done

xnew = (x * cos(theta)) - (y * sin(theta))

ynew = (x * sin(theta)) + (y * cos(theta))

For both of these equations, as the naive coder would accidentally use the same variable names for both the input and output which would produce faulty results.