From Curve Counting on Calabi-Yau 4-folds to Quasimaps for Quivers with Potentials