In fact there are differences, at least if you take rechtlich, rechtmäßig and gesetzlich as technical terms.
Rechtlich is simply the generic adjective to the noun "Recht" (law), so it has the broadest meaning of these terms. It doesn't qualify the object in matters of law (e.g., lawful / illegal), but simply connects the noun it pertains to to the legal sphere.
Rechtmäßig describes something as in accordance with the law. In german colloquial language, "legal" (stressed on the a) is used more often; it's synonymous to rechtmäßig.
Gesetzlich has a narrower meaning - it says something is in accordance with the written law that was officially enacted. The background is that there are different sources of law: Gesetze (statutes / bills / acts) concerning the whole population, and e.g. Verträge (contracts) as legal agreements between individuals. In colloquial language, "gesetzlich" may also be used synonymously with "rechtmäßig".
On that background, the terms rechtlicher Vertreter, gesetzlicher Vertreter and Rechtsvertreter indicated different meanings, too.
The "rechtliche Vertreter" (representative / agent) may act for someone else in legal matters, for example negotiating contracts. It's still a very broad term, and it doesn't indicate the source for that mandate - it may be itself based on a contract, too, or on statutes / acts.
The gesetzliche Vertreter pertains to a subset of the "rechtliche Vertreter" - those agents with a "statutory" mandate. E.g. the parents are "gesetzliche Vertreter" in relation to their children according to the German Civil Law Code.
Regarding "Rechtsvertreter", this may denote a "rechtlicher Vertreter" when used in colloquial language. But usually, this is someone who has the mandate to act in behalf of someone else in a specific legal matter, e.g. an attorney who files a suit for his client. The lawyer's mandate usually is restricted to that specific matter, while the legal mandate of the "gesetzliche Vertreter" is more universal - in the case of parents, covering almost every matter relating to their children (but this depends on the children's age).