The answer depends on the density of the beam. Gravity acts on the center of mass of the beam, whereas the buoyance force acts on the center of mass of the displaced water.
Depending on whether the center of mass of the displaced water lies left to the center of mass of the beam (i.e., square) or right, the beam tends to be turned clockwise or counterclockwise. So we want the two centers of mass (the one of the beam and the one of the water) to be on top of each other. Then there will be no torque, and the beam can swim in any configuration satisfying this condition. -- Really?
Hey, wait a moment: there is not only a question of equilibrium, but also of stability. If we turn the beam a bit away from its position (that happens all the time, say by bird's droppings on the beam, or by a slight breeze that agitates the water a bit), there will be a torque caused by the fact that the centers of mass are no longer on top of each other. Will this torque turn the beam further away or will it turn it back? Actual beams can only float in such a way that the torque turns the beam back.
Which coordinates do we want to choose for our calculations? Neither choice will avoid tedious calculations altogether. And, no, I will not show the calculations on the www page. I don't have the time to code all this in html, and you will want to do it yourself. But here is the result:
Normalize the density of water to 1, and consider beams of density at most 1/2. (The other case can be handeled very similarly, or, with sophisticated reasoning, reduced to the considered case.) If the density of the beam is at most (3-sqrt(3))/6, approximately 0.21133, then the beam will float with a side of the square horizontal. This is what you will find intuitive if you think of an actual beam made of styrofoam floating. However, if the density is larger than 9/32, namely 0.28125, then the beam floats with a corner pointing downward. But in between, the beam will do neither. It will rather tilt to one side increasingly. At density 1/4, the water level will actually be a line connecting one corner of the square with the midpoint of one square.