I made a shader intended to tile a texture over a mesh, and rotate each tile randomly in multiples of 90

Currently it’s working, although the scaling is off depending on the mesh, I’m guessing because of the UVs being different size. Making the shader triplanar somehow sounds like it’d fix the issue

Here’s an example of what it does:

3D mesh with tiled arrow texture, no shader:

texture arrows looking to the left

Same mesh after shader applied:

texture arrows looking at random places, in rotation multiples of 90

(some clear noise patterns are visible, but it’s good enough for me and fixing it sounds like a pain)

File in drive

Messy screenshot of the current working shader (not messy in the uploaded file above):

shader screenshot