Trinuclear clusters of early transition metals: Jahn-Teller distortions and electronic structure