I’ve re-read this and it might be confusing - what I mean is, the cross-section area of the square port should be the same as for the cylindrical port, and the length of the square port should be the same as the length of the cylindrical port.
As I understand it the straightforward calculation for port dimensions assumes that the inside end of the port is in free space inside the cabinet, not next to the cabinet wall, so that’s why calculating the right size for an end slot (or triangular corner port, etc) isn’t so easy.