Virtual crystal approximation revisited: Application to dielectric and piezoelectric properties of perovskites