Efficient algorithms for tensor scaling, quantum marginals and moment polytopes