JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="overlap" width="400" height="400"></canvas>

JavaScript

var overlap_canvas = document.getElementById("overlap");
  var overlap_context = overlap_canvas.getContext("2d");
  var x = 200;
  var y = x;
  var rectQTY = 4 // Number of rectangles
  
    overlap_context.translate(x,y);

    for (j=0;j<rectQTY;j++){	// Repeat for the number of rectangles
			
        // Draw a rectangle
         overlap_context.beginPath();
         overlap_context.rect(-90, -100, 180, 80);
         overlap_context.fillStyle = 'yellow';
         overlap_context.fill();
         overlap_context.lineWidth = 7;
         overlap_context.strokeStyle = 'blue';
         overlap_context.stroke();
        
        // Degrees to rotate for next position
        overlap_context.rotate((Math.PI/180)*360/rectQTY);
    }