Number each leg and the corner in which it fits for ease of reinstallation.
Find and remove any nails or screws holding the legs in place.
Use a dead blow hammer to remove any legs that are loose, but not completely broken off.
Sand off any old glue residue.
Reglue legs in the positions specified by the numbers placed in step one. Clamp to secure, and allow to dry for 24 hours.
Remove clamps and screw legs to the frame through the existing holes. If no screws or nails originally fastened the legs in place, screw each leg to the frame.