We present a four-flavour lattice calculation of the leading-order hadronic vacuum polarisation contribution to the anomalous magnetic moment of the muon, $a_mathrm{mu}^{rm hvp}$, arising from quark-connected Feynman graphs. It is based on ensembles featuring $N_f=2+1+1$ dynamical twisted mass fermions generated by the European Twisted Mass Collaboration (ETMC). Several light quark masses are used in order to yield a controlled extrapolation to the physical pion mass. We employ three lattice spacings to examine lattice artefacts and several different volumes to check for finite-size effects. Incorporating the complete first two generations of quarks allows for a direct comparison with phenomenological determinations of $a_mathrm{mu}^{rm hvp}$. Our final result including an estimate of the systematic uncertainty $$a_{mathrm{mu}}^{rm hvp} = 6.74(21)(18) cdot 10^{-8}$$ shows a good overall agreement with these computations.