Rare-earth-boron bonding and 4f state trends in RB4 tetraborides