How to rotate a GLSL texture

After creating a pattern in GLSL, what is the best way to go about applying it to existing geometry, assuming the surface will always be flat. Currently, I am using the GLSL vray shader in Maya. I essentially want the texture to be rotated in the same direction as the model it’s applied to.Processing: Screenshot 2024-01-13 142350.png…
Processing: Screenshot 2024-01-13 144038.png…

Generically a rotation in a shading language is applied with a 2-d formula. For a given point (u, v) and rotation Θ, the final rotation is

u = u * cos(Θ) - v * sin (Θ)
v = u * sin(Θ) + v * cos(Θ) 

That rotates you around (0,0). If you need to rotate around a different point subtract that from U and V first, do the rotation, then add it back in.