  Measurements of the cosmic microwave background polarization are vulnerable
to systematic contamination from beam imperfections. Because the unpolarized
CMB T is orders of magnitude larger than the polarized E and B signals, even a
tiny difference in instrument response between two orthogonally polarized
measurements of the CMB will result in a large non-zero differential signal,
even if the CMB is unpolarized. Two strategies to mitigate this
temperature-to-polarization leakage are the use of a rotating half-wave-plate
and the fitting and removal of leakage templates from the polarized signal. The
half-wave-plate approach will, in principle, work for arbitrary beam shapes,
but in practice introduces complicated additional optics that themselves can
introduce systematics. The template deprojection approach is simple and
requires no additional hardware, but so far has approximated beam shapes as
elliptical Gaussians. In this work, we generalize the deprojection technique to
clean leakage from mismatch of arbitrarily shaped beams. We find that our
technique will clean leakage from main beam mismatch to the level of r ~
1x10^{-5} without appreciable filtering of the cosmological signal.
