With only a few exceptions that are well understood, conventional superconductivity does not coexist with long-range magnetic order (for example, ref. 1). Unconventional superconductivity, on the other hand, develops near a phase boundary separating magnetically ordered and magnetically disordered phases. A maximum in the superconducting transition temperature T(c) develops where this boundary extrapolates to zero Kelvin, suggesting that fluctuations associated with this magnetic quantum-critical point are essential for unconventional superconductivity. Invariably, though, unconventional superconductivity masks the magnetic phase boundary when T < T(c), preventing proof of a magnetic quantum-critical point. Here we report specific-heat measurements of the pressure-tuned unconventional superconductor CeRhIn5 in which we find a line of quantum-phase transitions induced inside the superconducting state by an applied magnetic field. This quantum-critical line separates a phase of coexisting antiferromagnetism and superconductivity from a purely unconventional superconducting phase, and terminates at a quantum tetracritical point where the magnetic field completely suppresses superconductivity. The T --> 0 K magnetic field-pressure phase diagram of CeRhIn5 is well described with a theoretical model developed to explain field-induced magnetism in the high-T(c) copper oxides, but in which a clear delineation of quantum-phase boundaries has not been possible. These experiments establish a common relationship among hidden magnetism, quantum criticality and unconventional superconductivity in copper oxides and heavy-electron systems such as CeRhIn5.