Making square torus with square cross section Imagine a square donut with a square cross section.  Equivalently, imagine a thin cube with a square hole punched all the way through the middle of it.  I've tried so many ways, and they all fail due to having extra edges that prevent me from modifying the object as a whole.

I created a square tube by stretching a cube, subdividing, and extruding the end faces.  I got the shape I wanted easily, but permanent extra edges remained.

I created a large plane and then a smaller plane inside it, planning to remove the extra edges and vertically extrude the framework.  But I could not get rid of the edges without destroying things.

I created a large, flattish cube with a smaller cube above it.  I extruded the bottom of the smaller cube all the way through the larger cube, added a Boolean subtraction modifier to the larger cube and subtracted the smaller cube.  On first glance it appeared to be exactly what I wanted.  But then I saw that the operation had inserted unwanted edges connecting the external corners to the internal corners!  No matter what I did (delete or dissolve edges) the object was destroyed!

I need to be able to treat the result as a single object so I can twist it as a whole, but no matter what I do, I end up with a single object (in object mode) but essentially separate objects in Edit mode.

Please help!  Thank you.
Steps:


Create a Plane and convert it to Curve - Alt+C > Curve from Mesh/Text.
Add Bezier > Circle.
With Circle selected go to Data tab and choose Plane as a Bevel Object - you will probably need to scale down Plane.
Set Resolution > Preview U to desired density.
Add Solidify modifier and set Thickness. I've used minus value to create "inner" wall.
Convert your curve object to a mesh - Alt+C > Mesh from Curve/Meta/Surf/Text.
Optionally you can add Solidify again.