 
     // Fail-safe to ensure that we don't sample outside the rendered
     // portion of a blend source.
-    alpha *= point_inside_rect(vUv.xy, vUvClipBounds.xy, vUvClipBounds.zw);
+    alpha *= point_inside_rect(base_uv, vUvClipBounds.xy, vUvClipBounds.zw);
 
     // Pre-multiply the alpha into the output value.
     return Fragment(alpha * vec4(color, 1.0));

}

Fragment brush_fs() {
    vec4 Cs = texture(sColor0, vUv);

    if (Cs.a == 0.0) {
        return Fragment(vec4(0.0)); // could also `discard`

    vec2 uv = snap_device_pos(vi) +
        src_task.common_data.task_rect.p0 -
        src_task.content_origin;
    vUv = vec3(
        uv * gl_Position.w / texture_size, // multiply by W to compensate for perspective interpolation
        src_task.common_data.texture_layer_index
    );

    vec2 uv0 = src_task.common_data.task_rect.p0;
    vec2 uv1 = uv0 + src_task.common_data.task_rect.size;
