The problem you posed is known in the literature as the weighted region problem.
It was the focus of Joe Mitchell's Ph.D. thesis, under the direction of
Papadimitriou, and their results were eventually published in the Journal of the ACM:
"The weighted region problem: finding shortest paths through a weighted planar subdivision,"
Joseph S. B. Mitchell,
Christos H. Papadimitriou, Volume 38, Issue 1, Jan. 1991.
As maproom noted, Snell's law applies and helps.
Under the interpretation in this paper, the problem can be solved in polynomial time,
$O(n^8 L)$, where $L$ reflects the input precision (assumed to be integer coordinates)
and the output error tolerance $\epsilon$.
Here is their abstract.
The problem of determining shortest paths through a weighted planar polygonal subdivision with $n$ vertices is considered. Distances are measured according to a weighted Euclidean metric: The length of a path is defined to be the weighted sum of (Euclidean) lengths of the subpaths within each region. An algorithm that constructs a (restricted) “shortest path map” with respect to a given source point is presented. The output is a partitioning of each edge of the subdivion into intervals of $\epsilon$-optimality, allowing an $\epsilon$-optimal path to be traced from the source to any query point along any edge. The algorithm runs in worst-case time $O(ES)$ and requires $O(E)$ space, where $E$ is the number of “events” in our algorithm and $S$ is the time it takes to run a numerical search procedure. In the worst case, $E$ is bounded above by $O(n^4)$ (and we give an $\Omega(n^4)$ lower bound), but it is likeky that $E$ will be much smaller in practice. We also show that $S$ is bounded by $O(n^4L)$, where $L$ is the precision of the problem instance (including the number of bits in the user-specified tolerance $\epsilon$). Again, the value of $S$ should be smaller in practice. The algorithm applies the “continuous Dijkstra” paradigm and exploits the fact that shortest paths obey Snell's Law of Refraction at region boundaries, a local optimaly property of shortest paths that is well known from the analogous optics model. The algorithm generalizes to the multi-source case to compute Voronoi diagrams.
Here is their Fig. 4, illustrating that the shortest path between two points $x$ and $x'$ within
one region $f$ is not always the segment $x x'$: