Do you have a box laying around that you need to fill up with water or some other liquid? How in the world would you know exactly how many gallons would fit into that container?
Maybe you don't even need to pour liquid into the rectangular container. Maybe the liquid is already in there and you want to determine how many gallons are in there?
The article that I have linked below will teach you how to tell how many liquid gallons are in that container. Check it out
How to Determine Liquid Gallons in a Box Or Rectangular Container