         // 0 1 2
         // 3
         float4x4 top = float4x4(
-            tex2D(_MainTex, mainUV + float2(-k.x, -k.y)),
-            tex2D(_MainTex, mainUV + float2(0., -k.y)),
-            tex2D(_MainTex, mainUV + float2(k.x, -k.y)),
-            tex2D(_MainTex, mainUV + float2(-k.x, 0.)));
+            tex2D(_MainTex, uv + float2(-k.x, -k.y)),
+            tex2D(_MainTex, uv + float2(0., -k.y)),
+            tex2D(_MainTex, uv + float2(k.x, -k.y)),
+            tex2D(_MainTex, uv + float2(-k.x, 0.)));
 
         //     0
         // 1 2 3
         float4x4 bottom = float4x4(
-            tex2D(_MainTex, mainUV + float2(k.x, 0.)),
-            tex2D(_MainTex, mainUV + float2(-k.x, k.y)),
-            tex2D(_MainTex, mainUV + float2(0., k.y)),
-            tex2D(_MainTex, mainUV + float2(k.x, k.y)));
+            tex2D(_MainTex, uv + float2(k.x, 0.)),
+            tex2D(_MainTex, uv + float2(-k.x, k.y)),
+            tex2D(_MainTex, uv + float2(0., k.y)),
+            tex2D(_MainTex, uv + float2(k.x, k.y)));
 
         #if TAA_SHARPEN_OUTPUT
             float4 corners = (top[0] + top[2] + bottom[1] + bottom[3]) * .25;

        float4 vertex = mul(UNITY_MATRIX_MVP, input.vertex);

        output.vertex = vertex;
        output.mainTexUV = input.uv;
        output.defaultUV = input.uv;

    #if UNITY_UV_STARTS_AT_TOP
        if (_MainTex_TexelSize.y < 0)
            output.mainTexUV.y = 1. - input.uv.y;
    #endif

        return output;

    Output fragment(Varyings input)
    {
    #if TAA_DILATE_MOTION_VECTOR_SAMPLE
        float2 motion = tex2D(_CameraMotionVectorsTexture, getClosestFragment(input.uv.zw)).xy;
    #else
        float2 motion = tex2D(_CameraMotionVectorsTexture, input.uv.zw).xy;
    #endif

        float2 k = TAA_COLOR_NEIGHBORHOOD_SAMPLE_SPREAD * _MainTex_TexelSize.xy;
        float2 uv = input.uv.xy;
    #if TAA_REMOVE_COLOR_SAMPLE_JITTER && UNITY_UV_STARTS_AT_TOP
        uv -= _MainTex_TexelSize.y < 0 ? _Jitter * float2(1, -1) : _Jitter;
    #elif TAA_REMOVE_COLOR_SAMPLE_JITTER
        uv -= _Jitter;
    #endif

        float4 color = tex2D(_MainTex, uv);

    #if TAA_COLOR_NEIGHBORHOOD_SAMPLE_PATTERN == 0
        // Karis 13: a box filter is not stable under motion, use raw color instead of an averaged one
        float4x4 neighborhood = float4x4(
            tex2D(_MainTex, uv + float2(0., -k.y)),
            tex2D(_MainTex, uv + float2(-k.x, 0.)),
            tex2D(_MainTex, uv + float2(k.x, 0.)),
            tex2D(_MainTex, uv + float2(0., k.y)));

        #if TAA_SHARPEN_OUTPUT
            float4 edges = (neighborhood[0] + neighborhood[1] + neighborhood[2] + neighborhood[3]) * .25;
