title: Calculate (x,y) from (Lat,Lon) in a cropped equirectangular projection
body: <p>I have a <strong>piece of a map</strong> in <strong>equirectangular</strong> projection. I know (lat,lon) in left-top and bottom-right positions. Now I know I can calculate (x,y) like this:</p>
  
  <pre><code>x = ((lon + 180) * (map_width  / 360))
  y = (((lat * -1) + 90) * (map_height  / 180))
  </code></pre>
  
  <p>However, it seems that this produces wrong coordinates. My guess is that I have to take into account the left-top and bottom-right (lat,lon) for my image. </p>
  
  <p>So I tried this way (where left, top, right, bottom_lon respresent my image boundaries):</p>
  
  <pre><code>x = ((lon + left_lon) * (map_width  / (right_lon - left_lon)))
  y = (((lat * -1) + top_lat) * (map_height  / (top_lat - bottom_lat)))
  </code></pre>
  
  <p>But I still don't get the right result. What am I doing wrong?</p>