How do I pass variables to loops within includes?
You can't reference a variable (photo) created inside the partial loop outside the partial (and loop) – it doesn't exist yet – so what you're trying to achieve isn't possible.

What you could do, is to abstract the important bits, namely the field and transform handles:

{% set vars = {
    photos: projectEntries,
    photoField: 'projectPhotos_photo_image',
    photoTransform: 'projectThumbnail'
} %}
{% include "_partials/photo-tile.html" with vars %}


And inside your partial:

{% for photo in photos %}
   &lt;img src="{{ photo[photoField].first().getUrl(photoTransform) }}" /&gt;
{% endfor %}


If that doesn't cut it, you'll probably want to use a macro:

{# Your macro file, e.g. /templates/_macros/photoTile.html #}
{% macro src(photo) %}
    {{ photo.projectPhotos_photo_image.first().getUrl('projectThumbnail') }}
{% endmacro %}

{# Inside your partial #}
{% from '_macros/photoTile' import src %}
{% for photo in photos %}
    &lt;img src="{{- src(photo) -}}" /&gt;
{% endfor %}


(If you're wondering about the {{- -}} syntax in the above example, the dashes are just to remove whitespace from the rendered src string – you also wrap the code inside the macro in {% spaceless %}{% endspaceless %} tags.)