In this paper, we propose a method to optimally set the taps of voltage regulation transformers in distribution networks. Specifically, we cast the problem of optimally choosing the tap settings as a rank-constrained semidefinite program (SDP) with the transformer tap positions removed from the network's admittance matrix and replaced by additional constraints and optimization variables. Then, the non-convex rank-1 constraint that arises from this rank-constrained SDP formulation is relaxed, which leads to a convex SDP program. The tap positions are obtained from the primary- and secondary-side bus voltages yielded by the optimal solution. We present several case studies with a 14-bus single-phase and a 15-bus three-phase distribution system to demonstrate the validity of our method.