A Brazilian horse that garnered widespread attention after a TV news helicopter spotted it stranded on a rooftop has been rescued, officials say.