In this paper we study a proposal of Nekrasov, Rosly and Shatashvili that describes the effective twisted superpotential obtained from a class S theory geometrically as a generating function in terms of certain complexified length-twist coordinates, and extend it to higher rank. First, we introduce a higher rank analogue of Fenchel-Nielsen type spectral networks in terms of a generalized Strebel condition. We find new systems of spectral coordinates through the abelianization method and argue that they are higher rank analogues of the Nekrasov-Rosly-Shatashvili Darboux coordinates. Second, we give an explicit parametrization of the locus of opers and determine the generating functions of this Lagrangian subvariety in terms of the higher rank Darboux coordinates in some specific examples. We find that the generating functions indeed agree with the known effective twisted superpotentials. Last, we relate the approach of Nekrasov, Rosly and Shatashvili to the approach using quantum periods via the exact WKB method.It can be shown that any (E, ∇) admits at most one oper structure, and thus we can indeed identify opers with a subspace of M flat (C, SL(K)).More concretely, any SL(K) oper can locally be written as a Kth order linear differential operator 18) 2 Class S geometry Fix a positive integer K, sometimes called the "rank", and a possibly punctured Riemann surface C. We equip the Riemann surface with a collection