Functorial Semantics for Relational Theories