Upscale Shader

I am trying to do upcaling of a texture (from 128 to 512) in a shader but I am having trouble finishing it. What I do is look at a pixel and its 3 neighbors in the 128 texture and decide what 4x4 pixels to replace it with. The 4x4 pixels I have in a static array(upscaleLT) and just need to look up depending on the UV. But I fail to get the offset within the new texel for what 4x4 value to use. Any ideas?

            fixed4 frag (v2f i) : SV_Target
            {
                ...
                ...

                float2 targetRes = _MainTex_TexelSize.zw * 4.;
                float2 targetTexelSize = 1. / targetRes;
  -->           float2 targetTexelOffset = (i.uv % targetRes) % targetTexelSize / targetTexelSize;
               
                int pixelIndex = (targetTexelOffset.x + targetTexelOffset.y * 4.);

                fixed c = upscaleLT[upscaleIndex].pixels[pixelIndex];
          
                fixed4 col = fixed4(c, c, c, 1.);

                return col;
            }

The line with the arrow is the culprit that I cant figure out. Thanks for any input/help!

I got this solved in a different forum, if anyone run into a similar issue in the future I enter the solution here:

float2 targetTexelOffset = floor( ( i.uv * _MainTex_texelSize.zw * 4 ) % 4 );

Thanks to Remy_Unity for the solution!