title: Google Maps API setBounds of object
body: <p>How do I <strong>set</strong> the bounds of an existing object (Like a ground overlay, rectangle, etc.) in Google Maps API v3?</p>
  
  <p>For example:</p>
  
  <pre><code>// Assuming a map and a rectangle have already been created.
  
  var newBounds = new google.maps.LatLngBounds(
      new google.maps.LatLng(-20,-10),
      new google.maps.LatLng(50,30)
  );
  rectangle.setBounds(newBounds);
  </code></pre>
  
  <p>Is there an equivalent to <code>setBounds()</code>? </p>
  
  <p>Note: I could change the recangle's bounds array directly, but as Google keeps changing their variable keys for bounds this would eventually break the script.</p>