Couldn't you also consider this problem from the direction of a pressure fit?
In this case, if the height of each peg is the same then the "pressure fit" is equal for both the rectangular prism and the cylindrical hole described above.

A peg is a cylinder with a height, h. The peg would contact the sides of the square hole at the cylinder's tangents lines of length,h. Pressure = force*area. Pressure =force*(4h*negligible width of each contact line)

A rectangular prism peg with the same height, h would contact a cylindrical hole at it's 4 edges. Again the pressure would be equal. Pressure = force*4h*negligible width of each contact line.