I have not tried it myself, but I think that since you use the texture coordinates in a rectangular space, this will cause rotation distortion without any factor to fix it.
You will need to give it a shape that will declare the width and height of your texture. In doing so, you can apply aspect ratio to correct distortion.
coord = (coord - 0.5) * mat2(cos_factor, sin_factor, -sin_factor, cos_factor);
may become something like:
coord = vec2(coord.x - (0.5 * Resolution.x / Resolution.y), coord.y - 0.5) * mat2(cos_factor, sin_factor, -sin_factor, cos_factor);
As I said, I have not tried it, but I had to do this in the past for such shaders. You may need to change Resolution.x / Resolution.y.
source share