Theory of High Temperature Superconductivity in Cuprates and Other Doped Polar Insulators