changing uv coordinates on shared vertices accordingly

i have a tilemap consisting of quad(each 2 triangles) with shared vertices.

Now i want to use different textures on each quad which meant inverting die uv coordinates resulting in a flipped texture on every second
(horizontally in z and vertically on x direction.

0,0(v2) - 1,0(v5) - 0,0(v8)
|           |            |    
0,1(v1) - 1,1(v4) - 0,1(v7) 
|           |            |
0,0(v0) - 1,0(v3) - 0,0(v6)

I managed to flip Quad (1,0) vertically per shader by using vertex color flags - but by that i also changed the uv coordinates of the following quad(2,0) that was alligned correctly…

Is there a way in the shader to assign differing uv values to a coordinate depending on the quad that is being rendered?

As long as i cant distinguish which quad currently is being rendered in the shader and therefore which value the current uv coordinate should have, no additional encoding in vertex colors, uv2 can lead to a goal here right?

The goal would be quad(0,0) is being rendered : uv coordinate of vertex3 is 1,0 - when quad(1,0) is being rendered the same vertex3 should be uv 0,0.

(I didnt have this problem when i used unique vertices, since there every vertex also has it’s own uv coordinates - but i switched to shared vertices for the smooth look when deforming the map.)

I don’t have any experience in shaders, but i will dig into it if someone knows if this is possible at all.

Thanks for any input!

I solved the overall issue by keeping unique vertices and smoothing the overlapping vertexnormals by their normalized avergage for each group of vertices.

Only with geometry shaders you can handle vertices differently based on the quad they are in. A vertex shader actually only handles a shared vertex once and not once per usage in a triangle.

In a script it should actually not be that hard to split the vertices and change the uv’s while keeping the normals.