Interacting Hopf Algebras: the theory of linear systems