Decompose a GLSL mat4 to original RTS values within vertex shader to calculate a View UV Offset?

Hi All,
So i made this post in stack with a bounty but unable to find a solution.
I need to emulate large number of mirrors for a superposition project and i’m using quads to project slots of a texture grid (spritesheet-like) using billboards,
texture slots should switch according to the the combined viewing angle (view vector) and quad rotation.

I believe azimuth and elevation could be the key but I’m open to options other than cubemap abuse or moving the code to CPU side.

All help is appreciated.

stackpost:

jsfiddle:

weird case where the elevation is working perfectly as azimuth:

Thank you.