     vec2 outer = outer_scale * aRect.zw;
     vec2 clip_sign = 1.0 - 2.0 * outer_scale;
 
-    // Determine which side of the edge transition this
-    // fragment belongs to.
+    // Set some flags used by the FS to determine the
+    // orientation of the two edges in this corner.
     ivec2 edge_axis;
+    // Derive the positions for the edge clips, which must be handled
+    // differently between corners and edges.
+    vec2 edge_reference;
     switch (segment) {
         case SEGMENT_TOP_LEFT:
             edge_axis = ivec2(0, 1);
+            edge_reference = outer;
             break;
         case SEGMENT_TOP_RIGHT:
             edge_axis = ivec2(1, 0);
+            edge_reference = vec2(outer.x - aWidths.x, outer.y);
             break;
         case SEGMENT_BOTTOM_RIGHT:
             edge_axis = ivec2(0, 1);
+            edge_reference = outer - aWidths;
             break;
         case SEGMENT_BOTTOM_LEFT:
             edge_axis = ivec2(1, 0);
+            edge_reference = vec2(outer.x, outer.y - aWidths.y);
             break;
         case SEGMENT_TOP:
         case SEGMENT_BOTTOM:
             edge_axis = ivec2(1, 1);
+            edge_reference = vec2(0.0);
             break;
         case SEGMENT_LEFT:
         case SEGMENT_RIGHT:
         default:
             edge_axis = ivec2(0, 0);
+            edge_reference = vec2(0.0);
             break;
     }
 

    vec4 color0, color1;

    int segment = vConfig.x;
    int style0 = vConfig.y & 0xffff;
    int style1 = vConfig.y >> 16;
    ivec2 edge_axis = ivec2(vConfig.z & 0xffff, vConfig.z >> 16);

    float mix_factor = 0.0;

    } else {
        color0 = evaluate_color_for_style_in_edge(
            vPos,
            style.x,
            vColor0,
            aa_range,
            edge_axis.x
        );
        color1 = evaluate_color_for_style_in_edge(
            vPos,
            style.y,
            vColor1,
            aa_range,
            edge_axis.y
