Convex Formulation of Controller Synthesis for Piecewise-Affine Systems