Boundary regularity for the Monge-Ampere and affine maximal surface equations