Real and complex multiplication on K3 surfaces via period integration