Step 6: Build and attach legs
Turn the bed over, so that it is slats-down. Place a piece of 1x4 scrap in the inside corner of the 2x4 frame. Insert a leg, butting it to the 1x4, and attach it with (2) screws per 1x4, on the diagonal. Look at the photo. Remove the scrap, move it to the next corner, and repeat. The gap provided by the scrap helps to prevent squeaks.
Pay attention to the orientation of the legs, because in cross section one side is longer than the other. Structurally, it doesn't matter, but if you take the time to make a symmetrical layout, it will look better.