why not using the rotate function ?
https://github.com/melonjs/melonJS/blob/1.0.0-dev/src/math/matrix.js#L181