Well, I had a go at this and here is my solution. You can change the values of "horizontal_spacing" and "vertical_spacing" in the code to change the amount of space you want between the Picture2 and Rectangle2...
Sub align_picture_to_rectangle()
Dim horizontal_spacing As Single
Dim vertical_spacing As Single
Dim x_gap_calc As Single
Dim y_gap_calc As Single
Dim the_slide As Slide
Dim the_shape As shape
Dim the_rectangle As shape
Dim the_picture As shape
Dim slide_middle_x As Integer
Dim slide_middle_y As Integer
' Set the horizontal spacing here, it is a percentage of slide width
horizontal_spacing = 2
' Set the vertical spacing here, it is a percentage of slide height
vertical_spacing = 1.5
' Get middle of the slide to check where the rectangle is
slide_middle_x = ActivePresentation.PageSetup.SlideWidth / 2
slide_middle_y = ActivePresentation.PageSetup.SlideHeight / 2
' Calcuate the spacing
x_gap_calc = ActivePresentation.PageSetup.SlideWidth * (horizontal_spacing / 100)
y_gap_calc = ActivePresentation.PageSetup.SlideHeight * (vertical_spacing / 100)
' Loop through each slide
For Each the_slide In ActivePresentation.Slides
Set the_rectangle = Nothing
Set the_picture = Nothing
' Loop thorough each shape in slide
For Each the_shape In the_slide.Shapes
If the_shape.Name = "Rectangle 2" Then
Set the_rectangle = the_shape
End If
If the_shape.Name = "Picture 2" Then
Set the_picture = the_shape
End If
' Check if rectangle and picture has been found
If Not (the_rectangle Is Nothing) And Not (the_picture Is Nothing) Then
' Rectangle is on the right
If the_rectangle.Left > slide_middle_x Then
' Align picture on y axis to the rectangle center
the_picture.Top = the_rectangle.Top + (the_rectangle.Height / 2)
the_picture.Top = the_picture.Top - (the_picture.Height / 2)
' Create the gap, move the picture left
the_picture.Left = the_rectangle.Left - the_picture.Width
the_picture.Left = the_picture.Left - x_gap_calc
End If
' Rectangle is at the bottom
If the_rectangle.Top > slide_middle_y Then
' Align picture on x axis to the rectangle center
the_picture.Left = the_rectangle.Left + (the_rectangle.Width / 2)
the_picture.Left = the_picture.Left - (the_picture.Width / 2)
' Create the gap, move the picture up
the_picture.Top = the_rectangle.Top - the_picture.Height
the_picture.Top = the_picture.Top - y_gap_calc
End If
End If
Next
Next
End Sub