Legislative Bargaining with Endogenous Rules