Prevent Texture stretching on scaling with rotation

I would like to create a Material which increases tilling when I scale it, but still moves in object space and stays as it is when I rotate it. I masked out the xyz axis with PixelNormalWS and scaled the UV’s depending on ObejctScale. The Problem I am having right now is that PixelNormalWS obviously gets me the world rotation of that pixel, which is a problem on rotating the mesh. Is there a way to calculate/get the pixel normal in local space? Or is there a better way all together?

Preview:

![Cubes with texture bug] [1]

Material:

Download Rar with uassets

[Download Rar][2]