You didn't say what size the screws were, or if they were sold as "drywall screws". In my experience drywall screws aren't any good for fastening wood to wood. As you found, the heads break off.
Go to a larger square drive deck screw, #8 minimum, pre-drill & dip the point of the screw in paste wax (it doesn't take much).

Ed