   return vec4(aColor, pixelInCircle);
 }
 
-// We want to be in the center of the tile along the axis we're
-// repeating the circle but at the top for X axis and left for Y axis.
-// e.g. we only care about being equal spacing between circles for the edge we're drawing along
-// and snap the other axis to the top or left.
-vec2 adjust_dotted_padding(float radius) {
-  switch (vBorderPart) {
-    // These are the layer tile part PrimitivePart as uploaded by the tiling.rs
-    case PST_BOTTOM_RIGHT:
-    case PST_TOP_RIGHT:
-    case PST_BOTTOM_LEFT:
-    case PST_TOP_LEFT:
-      return vec2(-radius, -radius);
-    case PST_BOTTOM:
-    case PST_TOP:
-      return vec2(0, -radius);
-    case PST_LEFT:
-    case PST_RIGHT:
-      return vec2(-radius, 0);
-  }
-}
-
-vec4 draw_dotted_corner() {
-  return vec4(1, 0, 0, 1.0);
-}
-
 vec4 draw_dotted_edge() {
   // Everything here should be in device pixels.
   // We want the dot to be roughly the size of the whole border spacing
-  // 2.2 was picked because it's roughly what Firefox is using.
-  float spacing_fudge = 2.2;
   float border_spacing = min(vBorders.w, vBorders.z);
-  float radius = floor(border_spacing / spacing_fudge);
+  float radius = floor(border_spacing / 2.0);
   float diameter = radius * 2.0;
-  float circleSpacing = diameter * 2.0;
+  // The amount of space between dots. 2.2 was chosen because it looks kind of
+  // like firefox.
+  float circleSpacing = diameter * 2.2;
 
-  vec2 size = vec2(vBorders.z - vBorders.x, vBorders.w - vBorders.y);
+  vec2 size = vec2(vBorders.z, vBorders.w);
   // Get our position within this specific segment
   vec2 position = vPos - vBorders.xy;
 
   // Break our position into square tiles with circles in them.
-  vec2 circleCount = size / circleSpacing;
+  vec2 circleCount = floor(size / circleSpacing);
+  circleCount = max(circleCount, 1);
+
   vec2 distBetweenCircles = size / circleCount;
   vec2 circleCenter = distBetweenCircles / 2.0;
 

    case PST_TOP_RIGHT:
    case PST_BOTTOM_LEFT:
    case PST_BOTTOM_RIGHT:
      oFragColor = draw_dotted_edge();
      break;
    case PST_BOTTOM:


  // Where we want to draw the actual circle.
  vec2 tileCenter = destTile + circleCenter;

  // Find the position within the tile
  vec2 positionInTile = mod(position, distBetweenCircles);
