Multipolar engineering of molecules and materials for quadratic nonlinear optics