Texture Mirror
Task
Write a shader program that renders a texture on the screen. The texture is attached to the shader program through iChannel0. Lets assume the texture has a fixed aspect ratio of 1:1 (square).
Mirror Wrapping: when coordinates extend beyond the standard $[0, 1]$ range (due to the screen's aspect ratio), the shader must implement mirrored repeat behavior. This means the texture should flip its orientation every time it repeats.
Theory
We know that an image will appear on the surface where the texture coordinates $(u, v)$ are in the $[0, 1]$ range. But what happens outside of this range? Texture Wrapping functions determine this behavior.
Repeat
In the previous task, we implemented Repeat wrapping. In this mode, the image tiles itself across the surface:

Algorithmically, the integer part of the texture coordinates is discarded (using the fract function). This is ideal for covering a large surface with a seamless material like brick or grass.
Mirrored Repeat
Mirrored Repeat also causes the image to repeat across the surface, but it mirrors (flips) the texture on every other iteration:

For example, the image appears normally as coordinates move from $0$ to $1$, then reverses (mirrors) between $1$ and $2$, then appears normal again between $2$ and $3$, and so on. This creates a continuous, symmetrical pattern that eliminates the hard seams often visible in standard repetition.