x1 = [-0.5, 3.90];
y1 = [-0.5, 3.70];
x2 = [-3.90, 0.5];
y2 = [-3.70, 0.5];
axes('NextPlot', 'add');
line(x1([1,1,2,2,1]), y1([1,2,2,1,1]))
line(x2([1,1,2,2,1]), y2([1,2,2,1,1]))
The 2 areas overlap, so the volume above the overlapping rectangle is counted twice. Subtract it.